<template>
    <div class="box">
        <el-table :data="tableData" style="width: 100%">
            <el-table-column label="设备名称" prop="channelName"></el-table-column>
            <el-table-column label="设备状态" prop="stat">
                <template slot-scope="scope">
                    {{scope.row.stat?'在线':'离线'}}
                </template>
            </el-table-column>
            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button type="success" @click="cleanPlay(scope.row.id)" size="small">取消首页播放</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import {delHomeVideo,getHomeVideo} from '../../url/api'
export default {
    data(){
        return {
            tableData:[]
        }
    },
    methods:{
        cleanPlay(id){
            delHomeVideo(id).then(res=>{
                if(res.data.ok){
                    this.$message.success('操作成功');
                    this.getList();
                }
            })
        },
        getList(){
            getHomeVideo().then(res=>{
                this.tableData = res.data.data
            })
        }
    },
    mounted(){
        this.getList();
    }
};
</script>

<style lang="scss" scoped>
.box{
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100%;
    overflow-y: scroll;
}
.box::-webkit-scrollbar{
    width: 0;
}
</style>
